package com.liyy.platform.other.mytest;

import java.io.*;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class TestUDPSocket
{
	public static void main(String [] args) throws UnknownHostException, IOException{
		long l=10000L;
		ByteArrayOutputStream bis=new ByteArrayOutputStream();
		DataOutputStream dos=new DataOutputStream(bis);
		dos.writeLong(l);
//		byte buf[]=new String("hello").getBytes();
		byte buf1[]=bis.toByteArray();
		DatagramPacket dp =new DatagramPacket(buf1,buf1.length,new InetSocketAddress("127.0.0.1",7777));
		DatagramSocket ds =new DatagramSocket(2345);
		ds.send(dp);
		ds.close();
	}
	
}